LIB = av.so
SRC = lav.c \
	lav_consts.c \
	lav_flags.c \
	lav_format_context.c \
	lav_output_format.c \
	lav_frame.c \
	lav_stream.c \
	lav_codec_context.c \
	lav_codec.c \
	lav_packet.c \
	lav_sws_context.c

OBJ = $(SRC:%.c=%.o)
CFLAGS = -Wall -fPIC -g -I/usr/include/lua5.1
LDADD = -lavformat -lavcodec -lswscale -g
LUA = lua

all: $(LIB)

clean:
	-rm $(LIB) $(OBJ)

$(LIB): $(OBJ)
	$(CC) -shared $(LDADD) -o $@ $^

test: $(LIB)
	$(LUA) test.lua

stuff:
	@echo $(SRC:%.c=%.o)

.PHONY: all clean test

$(OBJ): av.h
